package com.sky.ContactManager;



import org.json.JSONException;
import org.json.JSONObject;

import com.sky.ContactManagerbase.Abonnee;

import android.app.Activity;
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;


public class Contacts extends Activity implements OnClickListener, OnItemClickListener{
	
	Abonnee abonnee;
	    ListView	mListview;
	    @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.contacts);
	        
	        mListview	=	((ListView)findViewById(R.id.listView1));
	        mListview.setOnClickListener(this);
	        mListview.setOnItemClickListener(this);
	        Intent intent=this.getIntent();
	    	String strabonnee =intent.getStringExtra("abonnee");
	    	Log.i("Commercant", strabonnee);
	    	
	    	try {
				JSONObject jabonnee=new JSONObject(strabonnee);
				Json_Parser parser=new Json_Parser();
				abonnee=parser.parse(this, jabonnee);
				
			} catch (JSONException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if(abonnee!=null)
			{
				ContactAdapter adapter=new ContactAdapter(this, abonnee);
				mListview.setAdapter(adapter);
			}
	    }
		@Override
		public void onClick(View v) {
			// TODO Auto-generated method stub
			
		}
		@Override
		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
				long arg3) {
			// TODO Auto-generated method stub
			
		}
}